package com.bluesky.dao.mapper;

import com.bluesky.dao.dataobject.UserPO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper {

    /**
     * 根据姓名查找
     */
    UserPO findUserByName(String name);
    /**
     * 根据id查找
     */
    @Select("SELECT * FROM user WHERE id = #{id}")
    UserPO findUserById(@Param("id") Long id);
    /**
     * 插入用户
     */
    @Insert("INSERT INTO user (name) VALUES (#{name})")
    void insertUser(@Param("name") String name);
    /**
     * 查询所有
     */
    @Select("SELECT * FROM user")
    List<UserPO> findAll();
}
